package JD;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception{
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        String s = buf.readLine();
        String[] ss;
        int n = Integer.parseInt(s);
        int[] x = new int[n];
        int[] y = new int[n];
        for (int i = 0; i < n; i++){
            s = buf.readLine();
            ss = s.split(" ");
            x[i] = Integer.parseInt(ss[0]);
            y[i] = Integer.parseInt(ss[1]);
        }
        int res = 0;
        for (int i = 0; i < n - 1; i++){
            for (int j = i + 1; j < n; j++){
                if (Math.abs(x[i] - x[j]) == Math.abs(y[i] - y[j])){
                    res++;
                }
            }
        }
        System.out.println(res);
    }
}
